package com.pkk.cloud.support.gataway.spring.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: 自定义的路由配置
 * @author: peikunkun
 * @create: 2019-08-08 10:09
 **/
//@Configuration
public class CustomRouteLocator {

  /**
   * @Description:可以绕过配置服务的规则路由，这样就可以拿到认证Token
   * @Param: [routeLocatorBuilder]
   * @return: org.springframework.cloud.gateway.route.RouteLocator
   * @Author: peikunkun
   * @Date: 2019/8/8 0008 上午 10:12
   */
  //@Bean
  public RouteLocator customRoute(RouteLocatorBuilder routeLocatorBuilder) {
    return routeLocatorBuilder.routes().route(r -> r.path("/login").uri("http://localhost:8080")).build();

  }

}
